<%-- 
    Document   : index8
    Created on : 2015-9-24, 14:56:45
    Author     : Fire
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script src="plugins/react/react.js" type="text/javascript"></script>
        <script src="plugins/react/browser.min.js" type="text/javascript"></script>
    </head>
    <body>
        <div id="example"></div>
        <script type="text/babel">
            var LikeButton = React.createClass({
                getInitialState : function(){
                    return {liked:false};
                },
                handleClick : function(){
                    this.setState({liked: !this.state.liked});
                },
                render : function(){
                    var text = this.state.liked ? 'like':'haven\'t liked';
                    return (
                     <p onClick={this.handleClick}>You {text} this. Click
                      to toggle</p>       
                     );
                }
            });
            React.render(
               <LikeButton />,
               document.getElementById('example')
            );
        </script>
    </body>
</html>
